const db = uniCloud.database();
const dbCmd = db.command;
const dbJQL = uniCloud.databaseForJQL()

module.exports = {
	_before: function() { // 通用预处理器
		this.clientInfo = this.getClientInfo();
	},
	async getProvide() {
		let res = await db.collection("mintz-city-data").where({
				type: 0
			}).orderBy("code", "asc")
			.get()
		return res
	},
	async getCity(parent_code) {
		let res = await db.collection("mintz-city-data").where({
				parent_code
			}).orderBy("code", "asc")
			.get()
		return res
	},

	_after(error, result) {
		if (error) {
			throw error
		}
		// result.timeCost = Date.now() - this.startTime
		// result.author="咸虾米开发"
		result.success = true
		result.code = 200
		return result;
	}
};